const Mock = require('mockjs')

const adaptiveData = Mock.mock({
  ip: '@ip',
  port: '@integer(1024,49151)',
  authStatus: '认证功能已开启'
})

const userData = Mock.mock({
  ip: '@ip',
  port: '@integer(1024,49151)',
  authStatus: '认证功能已开启'
})

const bioData = Mock.mock({
  ip: '@ip',
  port: '@integer(1024,49151)',
  authStatus: '认证功能已开启'
})

module.exports = [
  {
    url: '/yunwu-demo/serviceControl/serverStatus/start',
    type: 'get',
    response: config => {
      const { name } = config.query
      let item = userData
      if (name === 'adaptive') item = adaptiveData
      else if (name === 'user') item = userData
      else item = bioData

      return {
        code: 20000,
        data: item
      }
    }
  },
  {
    url: '/yunwu-demo/serviceControl/serverStatus/stop',
    type: 'get',
    response: _ => {
      return {
        code: 20000,
        data: 'success'
      }
    }
  }
]
